from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _

from ..utils.choices import IMAGE_TYPE


class SrcData(models.Model):
    """
    原始数据表
    """
    name = models.CharField(max_length=250, null=False, blank=True, verbose_name=_("name"))
    "数据大小"
    data_size = models.PositiveIntegerField(verbose_name=_("data size"))
    "项目"
    project = models.ForeignKey("projects.Project", verbose_name=_("project"), on_delete=models.CASCADE)
    "热成像图片路径"
    thermal_image = models.CharField(max_length=128, null=False, blank=True, verbose_name=_("thermal image"))
    "可见光图片路径"
    visible_image = models.CharField(max_length=128, null=False, blank=True, verbose_name=_("visible image"))
    "创建时间"
    created_date = models.DateTimeField(default=timezone.now, verbose_name=_("create date"))

    class Meta:
        verbose_name = "原始数据"
        verbose_name_plural = "原始数据"

    def __str__(self):
        return self.name


class MarkData(models.Model):
    """
    标注数据表
    """
    name = models.CharField(max_length=64, null=False, blank=True, verbose_name=_("name"))
    "数据张数"
    size = models.PositiveIntegerField(verbose_name=_("data size"))
    "类别数"
    category_number = models.PositiveIntegerField(verbose_name=_("category number"))
    "数据类别"
    category = models.CharField(max_length=500, null=False, blank=False, verbose_name=_("data category"))
    "创建时间"
    mark_date = models.DateTimeField(verbose_name=_("mark date"), auto_now_add=True)
    "数据类型"
    data_type = models.CharField(choices=IMAGE_TYPE, default=0, max_length=16, verbose_name=_("data type"))

    class Meta:
        verbose_name = "标注数据"
        verbose_name_plural = "标注数据"
